<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>手机站系统参数设置</title>
    {template 'stourtravel/public/public_js'}
    {php echo Common::getCss('style.css,base.css,base_new.css'); }
    {php echo Common::getScript('config.js');}
    {php echo Common::getScript("uploadify/jquery.uploadify.min.js"); }
    {php echo Common::getCss('uploadify.css','js/uploadify/'); }
</head>

<body>

	<table class="content-tab">
        <tr>
            <td width="119px" class="content-lt-td"  valign="top">
                {template 'stourtravel/public/leftnav'}
                <!--右侧内容区-->
            </td>
            <td valign="top" class="content-rt-td">
                <form id="configfrm">
                    <div class="w-set-con">
        	            <div class="cfg-header-bar">
                            <a href="javascript:;" class="fr btn btn-primary radius mr-10 mt-6" onclick="window.location.reload()">刷新</a>
                        </div>
                        <div class="w-set-nr">

                            <div id="m_basic_div" class="mitem">
                                <ul class="info-item-block">
                                    <li>
                                        <div class="item-bd" style="padding:0px 50px;">
                                            UNIAPP-H5移动端网址{Common::get_help_icon('uni_h5_url')}：{$h5_url}
                                            <span style="color: #DBDBDB;margin-left: 5px;">基于UNIAPP的移动端H5版地址,系统自动生成,不可修改.</span>
                                        </div>
                                    </li>
                                    <li>
                                        <span class="item-hd">首页标题{Common::get_help_icon('home_page_title')}：</span>
                                        <div class="item-bd">
                                            <input type="text" name="cfg_home_page_title" class="input-text w200" value="{$cfg_home_page_title}">
                                        </div>
                                    </li>
                                    <li>
                                        <span class="item-hd">首页公告{Common::get_help_icon('cfg_uni_index_notice')}：</span>
                                        <div class="item-bd">
                                            <input type="text" name="cfg_uni_index_notice" maxlength="200" class="input-text w400" value="{$cfg_uni_index_notice}">
                                        </div>
                                    </li>
                                </ul>
                            </div>
                            <div class="clear clearfix">
                                <a class="btn btn-primary size-L radius w100 ml-115" href="javascript:;" id="btn_save">保存</a>
                                <input type="hidden" name="webid" id="webid" value="0">
                            </div>
                        </div>
                    </div>
                </form>
            </td>
        </tr>
    </table>


    <script>
        $(document).ready(function () {
            //配置信息保存
            $("#btn_save").click(function () {
                var webid = $("#webid").val();
                Config.saveConfig(webid, function () {
                    ST.Util.showMsg('处理成功', 4, 1000);
                    clear_cache();
                });
            });


            // 清缓存
            function clear_cache() {
                $.ajax(
                    {
                        type: "post",
                        url: SITEURL + 'index/ajax_clearcache?clear=all',
                        beforeSend: function () {
                            ST.Util.showMsg('正在清除缓存,请稍后...', 6, 20000);
                        },
                        success: function (data) {
                            if (data == 'ok') {
                                ST.Util.showMsg('缓存清除成功', 4, 1000);
                                window.location.reload();
                            }
                        },

                        error: function () {

                            ST.Util.showMsg("请求出错,请联系管理员", 5, 1000);
                        }
                    }
                );
            }
            //初始化数据
            getConfig(0);
        });
        //获取配置
        function getConfig(webid) {
            Config.getConfig(webid, function (data) {

                console.log(data);
                if (data.cfg_m_icp != '') {
                    $("#cfg_m_icp").val(data.cfg_m_icp);
                }

            }, 'cfg_m_icp')

        }
    </script>
</body>
</html>
